#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
string s;
vector<string > v;
int main()
{
    IOS;
    s="aaabbbbccccc";
    ll ans=0;
    ll len=0;
    string temp;
    do{
        ll i;
        for(i=0;i<len;i++){
            if(v[i].find(s,0)!=string::npos)break;
        }
        if(i<len){
            continue;
        }
        temp=s+s;
        v.push_back(temp);
        reverse(temp.begin(),temp.end());
        v.push_back(temp);
        len+=2;
        ans++;
    }while(next_permutation(s.begin(),s.end()));
    cout<<ans<<endl;
    // cout<<1170<<endl;
    getchar();
    getchar();
    return 0;
}
